ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Population_Manager Class Reference

Base class for all population managers. More...

#include <PopulationManager.h>

Inheritance diagram for Population_Manager:
Bembidion_Population_Manager Goose_Population_Manager Hunter_Population_Manager Newt_Population_Manager Partridge_Population_Manager Rabbit_Population_Manager RodenticidePredators_Population_Manager RoeDeer_Population_Manager Skylark_Population_Manager THare_Population_Manager TPredator_Population_Manager Vole_Population_Manager

Public Member Functions

 Population_Manager (Landscape *L)
 
virtual ~Population_Manager (void)
 
void SetNoProbes (int a_pn)
 
unsigned GetLiveArraySize (int a_listindex)
 Gets the number of 'live' objects for a list index in the TheArray. More...
 
void IncLiveArraySize (int a_listindex)
 Increments the number of 'live' objects for a list index in the TheArray. More...
 
virtual void Catastrophe (int)
 
unsigned int FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal)
 
char * SpeciesSpecificReporting (int a_species, int a_time)
 
char * ProbeReport (int a_time)
 
char * ProbeReportTimed (int a_time)
 
void ImpactProbeReport (int a_Time)
 
bool BeginningOfMonth ()
 
void LOG (const char *fname)
 
int SupplyStepSize ()
 
int SupplySimW ()
 
int SupplySimH ()
 
virtual void Run (int NoTSteps)
 
virtual float Probe (int ListIndex, probe_data *p_TheProbe)
 
virtual void ImpactedProbe ()
 
int SupplyListNameLength ()
 
TAnimalSupplyAnimalPtr (int a_index, int a_animal)
 Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
 
unsigned SupplyListIndexSize ()
 
unsigned SupplyListSize (unsigned listindex)
 
bool CheckXY (int l, int i)
 Debug method to test for out of bounds coordinates. More...
 
const char * SupplyListName (int i)
 
bool IsLast (unsigned listindex)
 
int SupplyState (unsigned listindex, unsigned j)
 
virtual void SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y)
 
const char * SupplyStateNames (int i)
 
unsigned SupplyStateNamesLength ()
 
virtual void DisplayLocations ()
 
int ProbeFileInput (char *p_Filename, int p_ProbeNo)
 
TAnimalFindClosest (int x, int y, unsigned Type)
 
bool OpenTheRipleysOutputProbe (string a_NWordFilename)
 
void OpenTheAOROutputProbe (string a_AORFilename)
 
bool OpenTheMonthlyRipleysOutputProbe ()
 
bool OpenTheReallyBigProbe ()
 
virtual void TheAOROutputProbe ()
 
virtual void TheRipleysOutputProbe (FILE *a_prb)
 
virtual void TheReallyBigOutputProbe ()
 
void CloseTheMonthlyRipleysOutputProbe ()
 
virtual void CloseTheRipleysOutputProbe ()
 
virtual void CloseTheReallyBigOutputProbe ()
 
TTypesOfPopulation GetPopulationType ()
 
int GetSeasonNumber ()
 Get the season number. More...
 
void LamdaDeath (int x, int y)
 
void LamdaBirth (int x, int y)
 
void LamdaBirth (int x, int y, int z)
 
void LamdaClear ()
 
void LamdaDumpOutput ()
 
virtual int SupplyPegPosx (int)
 
virtual int SupplyPegPosy (int)
 
virtual int SupplyCovPosx (int)
 
virtual int SupplyCovPosy (int)
 
virtual bool OpenTheFledgelingProbe ()
 
virtual bool OpenTheBreedingPairsProbe ()
 
virtual bool OpenTheBreedingSuccessProbe ()
 
virtual void BreedingPairsOutput (int)
 
virtual int TheBreedingFemalesProbe (int)
 
virtual int TheFledgelingProbe ()
 
virtual void BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int)
 
virtual int TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &)
 
virtual void FledgelingProbeOutput (int, int)
 
virtual void TheGeneticProbe (unsigned, int, unsigned &)
 
virtual void GeneticsResultsOutput (FILE *, unsigned)
 

Public Attributes

int IndexArrayX [5][10000]
 
probe_dataTheProbe [100]
 
int SimH
 
int SimW
 
unsigned SimHH
 
unsigned SimWH
 
char m_SimulationName [255]
 
bool ProbesSet
 
Landscapem_TheLandscape
 

Protected Member Functions

virtual bool StepFinished ()
 Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More...
 
virtual void DoFirst ()
 
virtual void DoBefore ()
 
virtual void DoAfter ()
 
virtual void DoAlmostLast ()
 
virtual void DoLast ()
 
void EmptyTheArray ()
 Removes all objects from the TheArray by deleting them and clearing TheArray. More...
 
void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
unsigned PartitionLiveDead (unsigned Type)
 
void Shuffle_or_Sort (unsigned Type)
 
void Shuffle (unsigned Type)
 
virtual void Catastrophe ()
 

Protected Attributes

vector< unsigned > m_LiveArraySize
 
int m_NoProbes
 
AOR_Probem_AOR_Probe
 
FILE * m_GeneticsFile
 
FILE * m_AlleleFreqsFile
 
FILE * m_EasyPopRes
 
const char * StateNames [100]
 
int m_catastrophestartyear
 
int m_StepSize
 
vector< TListOfAnimalsTheArray
 
unsigned StateNamesLength
 
const char * m_ListNames [32]
 
unsigned m_ListNameLength
 
FILE * TestFile
 
FILE * TestFile2
 
unsigned BeforeStepActions [12]
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type
 
ofstream * AOROutputPrb
 
FILE * RipleysOutputPrb
 
FILE * RipleysOutputPrb1
 
FILE * RipleysOutputPrb2
 
FILE * RipleysOutputPrb3
 
FILE * RipleysOutputPrb4
 
FILE * RipleysOutputPrb5
 
FILE * RipleysOutputPrb6
 
FILE * RipleysOutputPrb7
 
FILE * RipleysOutputPrb8
 
FILE * RipleysOutputPrb9
 
FILE * RipleysOutputPrb10
 
FILE * RipleysOutputPrb11
 
FILE * RipleysOutputPrb12
 
FILE * ReallyBigOutputPrb
 
long int lamdagrid [2][257][257]
 

Detailed Description

Base class for all population managers.

The core of the handling of animal populations. All time-step code and most input/output is handled by this class and its descendents. This class effectively implements a state machine to facilitate simulation of animal behaviours and handle potential issues with concurrency. The PopulationManager class is never instantiated but must be used by deriving a descendent class.

Constructor & Destructor Documentation

◆ Population_Manager()

Population_Manager::Population_Manager ( Landscape L)

Constructor for the Population_Manager class

221  {
222  // Keep a pointer to the landscape this population is in
223  m_TheLandscape = L;
224  // create 10 empty arrays as default, excess can be removed in descendent classes
225  TListOfAnimals alist;
226  TheArray.insert( TheArray.end(), 12, alist );
227  // Set the simulation bounds
232 
233  // dww this is hardcoded limit of 12.
234  // Needs fixing
235  for (int i = 0; i < 12; i++) {
236  // Set default BeforeStepActions
237  BeforeStepActions[ i ] = 0;
238  m_ListNames[ i ] = "Unknown";
239  m_LiveArraySize.push_back( 0 );
240  }
241  // modify this if they need to in descendent classes
242  StateNamesLength = 0; // initialise this variable.
243  m_catastrophestartyear=-1; // Default is don't do this
244 #ifdef __LAMBDA_RECORD
245  ofstream fout("LambdaGridOuput.txt", ios_base::out); // open for writing
246  fout.close();
247  LamdaClear();
248 #endif
251  }
252  if (cfg_AOROutput_used.value()) {
253  OpenTheAOROutputProbe("AOR_Probe.txt");
254  }
255  // Ensure the GUI pointer is NULL in case we are not in GUI mode
256 #ifdef __ALMASS_VISUAL
257  m_MainForm = NULL;
258 #endif
259  m_SeasonNumber = 0; // Ensure that we start in season number 0. Season number is incremented at day in year 183
260 }
CfgBool cfg_AOROutput_used("G_AOROUTPUT_USED", CFG_CUSTOM, false)
CfgBool cfg_RipleysOutputMonthly_used("G_RIPLEYSOUTPUTMONTHLY_USED", CFG_CUSTOM, false)
vector< TAnimal * > TListOfAnimals
Definition: PopulationManager.h:50
bool value(void)
Definition: configurator.h:135
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
int SimH
Definition: PopulationManager.h:511
const char * m_ListNames[32]
Definition: PopulationManager.h:537
vector< unsigned > m_LiveArraySize
Definition: PopulationManager.h:524
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
void OpenTheAOROutputProbe(string a_AORFilename)
Definition: PopulationManager.cpp:771
int m_SeasonNumber
Holds the season number. Used when running goose and hunter sims.
Definition: PopulationManager.h:544
int m_catastrophestartyear
Definition: PopulationManager.h:532
void LamdaClear()
Definition: PopulationManager.h:609
bool OpenTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:778
unsigned SimWH
Definition: PopulationManager.h:512
unsigned SimHH
Definition: PopulationManager.h:512
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
int SimW
Definition: PopulationManager.h:511
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
unsigned StateNamesLength
Definition: PopulationManager.h:535

References cfg_AOROutput_used, cfg_RipleysOutputMonthly_used, Landscape::SupplySimAreaHeight(), and CfgBool::value().

◆ ~Population_Manager()

Population_Manager::~Population_Manager ( void  )
virtual

Destructor for the Population_Manager class

266  {
267  // clean-up
268  for ( unsigned i = 0; i < TheArray.size(); i++ ) {
269  // if objects in the list need to be deleted:
270  for ( unsigned j = 0; j < (unsigned) GetLiveArraySize(i); j++ ) {
271  delete TheArray[ i ] [ j ];
272  }
273  // empty the array
274  TheArray[ i ].clear();
275  // --
276  }
277  if ( cfg_RipleysOutput_used.value() ) {
279  }
282  }
285  }
286  if (cfg_AOROutput_used.value()) delete m_AOR_Probe;
287 }
CfgBool cfg_ReallyBigOutput_used("G_REALLYBIGOUTPUT_USED", CFG_CUSTOM, false)
CfgBool cfg_RipleysOutput_used("G_RIPLEYSOUTPUT_USED", CFG_CUSTOM, false)
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526
virtual void CloseTheReallyBigOutputProbe()
Definition: PopulationManager.cpp:904
virtual void CloseTheRipleysOutputProbe()
Definition: PopulationManager.cpp:874
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
void CloseTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:885

References cfg_AOROutput_used, cfg_ReallyBigOutput_used, cfg_RipleysOutput_used, cfg_RipleysOutputMonthly_used, and CfgBool::value().

Member Function Documentation

◆ BeginningOfMonth()

bool Population_Manager::BeginningOfMonth ( )

Is it the first day of the month?

1102  {
1103  if ( m_TheLandscape->SupplyDayInMonth() == cfg_DayInMonth.value() ) return true;
1104  return false;
1105 }
static CfgInt cfg_DayInMonth("PRB_DAYINMONTH", CFG_CUSTOM, 1)
int value(void)
Definition: configurator.h:98
int SupplyDayInMonth(void)
Definition: landscape.h:1606

References cfg_DayInMonth, and CfgInt::value().

◆ BreedingPairsOutput()

virtual void Population_Manager::BreedingPairsOutput ( int  )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

641  {
642  }

◆ BreedingSuccessProbeOutput()

virtual void Population_Manager::BreedingSuccessProbeOutput ( double  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int   
)
inlinevirtual

Reimplemented in Skylark_Population_Manager.

649  {
650  }

◆ Catastrophe() [1/2]

void Population_Manager::Catastrophe ( void  )
protectedvirtual

This method MUST be overidden in descendent classes if this functionality is does not match with the animals requirements

Reimplemented in Vole_Population_Manager, Skylark_Population_Manager, Partridge_Population_Manager, THare_Population_Manager, and Bembidion_Population_Manager.

1109  {
1114  return;
1115 }

◆ Catastrophe() [2/2]

virtual void Population_Manager::Catastrophe ( int  )
inlinevirtual
440  {
441  }

◆ CheckXY()

bool Population_Manager::CheckXY ( int  l,
int  i 
)

Debug method to test for out of bounds coordinates.

1519 {
1520  if (TheArray[l][i]->Supply_m_Location_x() > 10000) return true;
1521  if (TheArray[l][i]->Supply_m_Location_y() > 10000) return true;
1522  if (TheArray[l][i]->Supply_m_Location_x() < 0) return true;
1523  if (TheArray[l][i]->Supply_m_Location_y() < 0) return true;
1524  return false;
1525 }

◆ CloseTheMonthlyRipleysOutputProbe()

void Population_Manager::CloseTheMonthlyRipleysOutputProbe ( )

close the monthly probes

885  {
886  fclose( RipleysOutputPrb1 );
887  fclose( RipleysOutputPrb2 );
888  fclose( RipleysOutputPrb3 );
889  fclose( RipleysOutputPrb4 );
890  fclose( RipleysOutputPrb5 );
891  fclose( RipleysOutputPrb6 );
892  fclose( RipleysOutputPrb7 );
893  fclose( RipleysOutputPrb8 );
894  fclose( RipleysOutputPrb9 );
895  fclose( RipleysOutputPrb10 );
896  fclose( RipleysOutputPrb11 );
897  fclose( RipleysOutputPrb12 );
898 }
FILE * RipleysOutputPrb7
Definition: PopulationManager.h:589
FILE * RipleysOutputPrb1
Definition: PopulationManager.h:583
FILE * RipleysOutputPrb12
Definition: PopulationManager.h:594
FILE * RipleysOutputPrb8
Definition: PopulationManager.h:590
FILE * RipleysOutputPrb11
Definition: PopulationManager.h:593
FILE * RipleysOutputPrb9
Definition: PopulationManager.h:591
FILE * RipleysOutputPrb5
Definition: PopulationManager.h:587
FILE * RipleysOutputPrb10
Definition: PopulationManager.h:592
FILE * RipleysOutputPrb6
Definition: PopulationManager.h:588
FILE * RipleysOutputPrb3
Definition: PopulationManager.h:585
FILE * RipleysOutputPrb2
Definition: PopulationManager.h:584
FILE * RipleysOutputPrb4
Definition: PopulationManager.h:586

◆ CloseTheReallyBigOutputProbe()

void Population_Manager::CloseTheReallyBigOutputProbe ( )
virtual

close the probe

Reimplemented in TPredator_Population_Manager, and Goose_Population_Manager.

904  {
905  if ( ReallyBigOutputPrb != 0 )
906  fclose( ReallyBigOutputPrb );
908 }
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595

◆ CloseTheRipleysOutputProbe()

void Population_Manager::CloseTheRipleysOutputProbe ( )
virtual

close the probe

Reimplemented in TPredator_Population_Manager, and Goose_Population_Manager.

874  {
876  fclose( RipleysOutputPrb );
877  RipleysOutputPrb=NULL;
878 }
FILE * RipleysOutputPrb
Definition: PopulationManager.h:582

References cfg_RipleysOutputMonthly_used, and CfgBool::value().

◆ DisplayLocations()

void Population_Manager::DisplayLocations ( )
virtual

Used to update the graphics when control is not returned to the ALMaSS_GUI between timesteps.

561 {
565 #ifdef __ALMASS_VISUAL
566  m_MainForm->UpdateGraphics();
567 #endif
568 }

◆ DoAfter()

void Population_Manager::DoAfter ( )
protectedvirtual

Can be used in descendent classes

Reimplemented in TPredator_Population_Manager, Rabbit_Population_Manager, Partridge_Population_Manager, Hunter_Population_Manager, and Goose_Population_Manager.

513  {
514  //TODO: Add your source code here
515 }

◆ DoAlmostLast()

void Population_Manager::DoAlmostLast ( void  )
protectedvirtual

Can be used in descendent classes

Reimplemented in Bembidion_Population_Manager, Partridge_Population_Manager, and THare_Population_Manager.

522  {
523  //TODO: Add your source code here
524 }

◆ DoBefore()

void Population_Manager::DoBefore ( void  )
protectedvirtual

◆ DoFirst()

◆ DoLast()

void Population_Manager::DoLast ( void  )
protectedvirtual

Collects some data to describe the number of animals in each state at the end of the day

Reimplemented in Bembidion_Population_Manager, TPredator_Population_Manager, Rabbit_Population_Manager, Partridge_Population_Manager, Hunter_Population_Manager, THare_Population_Manager, and Goose_Population_Manager.

530  {
531 
532 /*
533 #ifdef __UNIX__
534  for ( unsigned i = 0; i < 100; i++ ) {
535  StateList.n[ i ] = 0;
536  }
537 #else
538  // Zero results
539  for ( unsigned listindex = 0; listindex < m_ListNameLength; listindex++ ) {
540  for ( unsigned i = 0; i < 100; i++ ) {
541  Counts[ listindex ] [ i ] = 0;
542  }
543  }
544 #endif
545  // How many animals in each state?
546  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
547  unsigned size = (unsigned) TheArray[ listindex ].size();
548  for ( unsigned j = 0; j < size; j++ ) {
549 #ifdef __UNIX__
550  StateList.n[ TheArray[ listindex ] [ j ]->WhatState() ] ++;
551 #else
552  Counts[ listindex ] [ TheArray[ listindex ] [ j ]->WhatState() ] ++;
553 #endif
554  }
555  }
556 */
557 }

Referenced by THare_Population_Manager::DoLast(), Partridge_Population_Manager::DoLast(), and Bembidion_Population_Manager::DoLast().

◆ EmptyTheArray()

void Population_Manager::EmptyTheArray ( )
protected

Removes all objects from the TheArray by deleting them and clearing TheArray.

Sort TheArray w.r.t. the m_Location_x attribute

963 {
964  for ( unsigned i = 0; i < TheArray.size(); i++ )
965  {
966  // if objects in the list need to be deleted:
967  for (unsigned j = 0; j < (unsigned) TheArray[i].size(); j++)
968  {
969  delete TheArray[ i ] [ j ];
970  }
971  // empty the array
972  TheArray[ i ].clear();
973  }
974 }

◆ FarmAnimalCensus()

unsigned int Population_Manager::FarmAnimalCensus ( unsigned int  a_farm,
unsigned int  a_typeofanimal 
)
1262 {
1263  unsigned int No = 0;
1264  unsigned sz = (unsigned)GetLiveArraySize( a_typeofanimal );
1265  for ( unsigned j = 0; j < sz; j++ )
1266  {
1267  if (a_farm == TheArray[ a_typeofanimal ] [ j ]->SupplyFarmOwnerRef()) No++;
1268  }
1269  return No;
1270 }

◆ FindClosest()

TAnimal * Population_Manager::FindClosest ( int  x,
int  y,
unsigned  Type 
)

Finds the closest individual to an x,y point

937  {
938  int distance = 100000000;
939  TAnimal * TA = NULL;
940  int dx, dy, d;
941  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( Type ); j++) {
942  dx = TheArray[ Type ] [ j ]->Supply_m_Location_x();
943  dy = TheArray[ Type ] [ j ]->Supply_m_Location_y();
944  dx = ( dx - x );
945  dx *= dx;
946  dy = ( dy - y );
947 
948  dy *= dy;
949  d = dx + dy;
950  if ( d < distance ) {
951  distance = d;
952  TA = TheArray[ Type ] [ j ];
953  }
954  }
955  return TA;
956 }
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205

References TAnimal::Supply_m_Location_x().

◆ FledgelingProbeOutput()

virtual void Population_Manager::FledgelingProbeOutput ( int  ,
int   
)
inlinevirtual

Reimplemented in Skylark_Population_Manager.

654  {
655  }

◆ GeneticsResultsOutput()

virtual void Population_Manager::GeneticsResultsOutput ( FILE *  ,
unsigned   
)
inlinevirtual

Reimplemented in Vole_Population_Manager.

658  {
659  }

◆ GetLiveArraySize()

unsigned Population_Manager::GetLiveArraySize ( int  a_listindex)
inline

Gets the number of 'live' objects for a list index in the TheArray.

433  {
434  return m_LiveArraySize[a_listindex];
435  }

References m_LiveArraySize.

Referenced by Goose_Population_Manager::BirdsShot(), Skylark_Population_Manager::BreedingPairsOutput(), Rabbit_Warren::CalcDisease(), Bembidion_Population_Manager::Catastrophe(), THare_Population_Manager::Catastrophe(), Skylark_Population_Manager::Catastrophe(), Vole_Population_Manager::Catastrophe(), Skylark_Population_Manager::CreateObjects(), Goose_Population_Manager::CreateObjects(), Newt_Population_Manager::CreateObjects(), Bembidion_Population_Manager::CreateObjects(), THare_Population_Manager::CreateObjects(), Vole_Population_Manager::CreateObjects(), Goose_Population_Manager::DoEmigration(), THare_Population_Manager::DoFirst(), Newt_Population_Manager::DoFirst(), Vole_Population_Manager::DoFirst(), Bembidion_Population_Manager::DoFirst(), Goose_Population_Manager::DoLast(), AOR_Probe_Goose::DoProbe(), THare_Population_Manager::ExtraPopMort(), Vole_Population_Manager::FindOutsideRadiusMale(), Vole_Population_Manager::FindRandomMale(), Vole_Population_Manager::GeneticsOutputFile(), Vole_Population_Manager::GeneticsResultsOutput(), Goose_Population_Manager::GetLeader(), Goose_Population_Manager::GoosePopulationDescriptionOutput(), THare_Population_Manager::Hunting(), THare_Population_Manager::HuntingDifferentiatedBeetleBankArea(), THare_Population_Manager::HuntingGrid(), Vole_Population_Manager::ImpactedProbe(), Vole_Population_Manager::LandscapeQuadrantOutputProbe(), THare_Population_Manager::MRROutputs(), Newt_Population_Manager::Newt_Population_Manager(), Newt_Population_Manager::OutputMetamorphosisStats(), THare_Population_Manager::POMOutputs(), Bembidion_Population_Manager::Probe(), Skylark_Population_Manager::ProbePOM(), Skylark_Population_Manager::ReHouse(), Vole_Population_Manager::ResistanceOutput(), Vole_Population_Manager::SendMessage(), Vole_Population_Manager::TheAgeSexLocationProbe(), Skylark_Population_Manager::TheBreedingFemalesProbe(), Skylark_Population_Manager::TheBreedingSuccessProbe(), Skylark_Population_Manager::TheFledgelingProbe(), Bembidion_Population_Manager::TheReallyBigOutputProbe(), Vole_Population_Manager::TheReallyBigOutputProbe(), Bembidion_Population_Manager::TheRipleysOutputProbe(), THare_Population_Manager::TheRipleysOutputProbe(), Skylark_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheSexRatiosProbe(), and Goose_Population_Manager::XYDump().

◆ GetPopulationType()

TTypesOfPopulation Population_Manager::GetPopulationType ( )
inline
576 { return m_population_type; }
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580

References m_population_type.

◆ GetSeasonNumber()

int Population_Manager::GetSeasonNumber ( )
inline

◆ ImpactedProbe()

void Population_Manager::ImpactedProbe ( )
virtual

Special pesticide related probe. Overidden in descendent classes

Reimplemented in Vole_Population_Manager.

672  {
673 
674 }

◆ ImpactProbeReport()

void Population_Manager::ImpactProbeReport ( int  a_Time)

Special probe

1321  {
1322 
1323  for ( int ProbeNo = 0; ProbeNo < 1; ProbeNo++ ) {
1324  // See if we need to record/update this one
1325  // if time/months/years ==0 or every time
1326  if ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1327  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 2 ) && ( BeginningOfMonth() ) )
1328  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( a_Time % 365 == 0 ) ) ) {
1329  ImpactedProbe();
1330  }
1331  }
1332 }
virtual void ImpactedProbe()
Definition: PopulationManager.cpp:672
bool BeginningOfMonth()
Definition: PopulationManager.cpp:1102
probe_data * TheProbe[100]
Definition: PopulationManager.h:510

References BeginningOfMonth().

◆ IncLiveArraySize()

void Population_Manager::IncLiveArraySize ( int  a_listindex)
inline

◆ IsLast()

bool Population_Manager::IsLast ( unsigned  listindex)
inline
481  {
482  if (TheArray[listindex].size() > 1) return false; else
483  return true;
484  }

References TheArray.

◆ LamdaBirth() [1/2]

void Population_Manager::LamdaBirth ( int  x,
int  y 
)
inline
603  {
604  lamdagrid[0][x / __lgridsize][y / __lgridsize]++;
605  }
long int lamdagrid[2][257][257]
Definition: PopulationManager.h:597

References lamdagrid.

Referenced by Bembidion_Egg_List::st_Hatch().

◆ LamdaBirth() [2/2]

void Population_Manager::LamdaBirth ( int  x,
int  y,
int  z 
)
inline
606  {
607  lamdagrid[0][x / __lgridsize][y / __lgridsize] += z;
608  }

References lamdagrid.

◆ LamdaClear()

void Population_Manager::LamdaClear ( )
inline
609  {
610  for (int i = 0; i < 257; i++) {
611  for (int j = 0; j < 257; j++) {
612  lamdagrid[0][i][j] = 0;
613  lamdagrid[1][i][j] = 0;
614  }
615  }
616  }

References lamdagrid.

Referenced by Bembidion_Population_Manager::DoFirst().

◆ LamdaDeath()

void Population_Manager::LamdaDeath ( int  x,
int  y 
)
inline
599  {
600  // inlined for speed
601  lamdagrid[1][x / __lgridsize][y / __lgridsize]++;
602  }

References lamdagrid.

Referenced by Bembidion_Base::st_Die().

◆ LamdaDumpOutput()

void Population_Manager::LamdaDumpOutput ( )

Special probe

657  {
658  ofstream fout("LambdaGridOuput.txt", ios_base::app); // open for writing
659  for (int i=0; i<257; i++ ) {
660  for (int j=0; j<257; j++) {
661  fout << lamdagrid[0][i][j] << "\t" << lamdagrid[1][i][j] << endl;
662  }
663  }
664  //fout << "NEXT" << endl;
665  fout.close();
666 }

Referenced by Bembidion_Population_Manager::DoFirst().

◆ LOG()

void Population_Manager::LOG ( const char *  fname)

Debug function used to log whatever is needed - this is just a place to write whatever is needed at the time - so contents vary

294  {
295  FILE * PFile = fopen(fname, "w" );
296  if (PFile) {
297  m_TheLandscape->Warn("PopulationManager::LOG - Could not open file ",fname);
298  exit(0);
299  }
300  AnimalPosition AP;
301  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
302 #ifndef __BCB__
303  fprintf( PFile, "%s :\n", m_ListNames[ listindex ] );
304 #else
305  fprintf( PFile, "%s :\n", m_ListNames[ listindex ].c_str() );
306 #endif
307  for ( unsigned j = 0; j < (unsigned) m_LiveArraySize[listindex]; j++ ) {
308  AP = TheArray[ listindex ] [ j ]->SupplyPosition();
309  fprintf( PFile, "%i %i %i\n", j, AP.m_x, AP.m_y );
310  }
311  }
312  fclose( PFile );
313 }
A class defining an animals position.
Definition: PopulationManager.h:170
unsigned m_x
Definition: PopulationManager.h:172
unsigned m_y
Definition: PopulationManager.h:173
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579

References AnimalPosition::m_x, and AnimalPosition::m_y.

◆ OpenTheAOROutputProbe()

void Population_Manager::OpenTheAOROutputProbe ( string  a_AORFilename)

open the AOR Grid probe

771  {
772  m_AOR_Probe = new AOR_Probe(this, m_TheLandscape, a_AORFilename);
773 }
Definition: AOR_Probe.h:6

◆ OpenTheBreedingPairsProbe()

virtual bool Population_Manager::OpenTheBreedingPairsProbe ( )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

635  {
636  return false;
637  }

Referenced by CreatePopulationManager().

◆ OpenTheBreedingSuccessProbe()

virtual bool Population_Manager::OpenTheBreedingSuccessProbe ( )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

638  {
639  return false;
640  }

Referenced by CreatePopulationManager().

◆ OpenTheFledgelingProbe()

virtual bool Population_Manager::OpenTheFledgelingProbe ( )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

632  {
633  return false;
634  }

Referenced by CreatePopulationManager().

◆ OpenTheMonthlyRipleysOutputProbe()

bool Population_Manager::OpenTheMonthlyRipleysOutputProbe ( )

open 12 ripley output probles, one for each month

778  {
779  RipleysOutputPrb1 = fopen("RipleyOutput_Jan.txt", "w" );
780  if ( !RipleysOutputPrb1 ) {
781  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
783  exit( 1 );
784  }
785  RipleysOutputPrb2 = fopen("RipleyOutput_Feb.txt", "w" );
786  if ( !RipleysOutputPrb2 ) {
787  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
789  exit( 1 );
790  }
791  RipleysOutputPrb3 = fopen("RipleyOutput_Mar.txt", "w" );
792  if ( !RipleysOutputPrb3 ) {
793  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
795  exit( 1 );
796  }
797  RipleysOutputPrb4 = fopen("RipleyOutput_Apr.txt", "w" );
798  if ( !RipleysOutputPrb4 ) {
799  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
801  exit( 1 );
802  }
803  RipleysOutputPrb5 = fopen("RipleyOutput_May.txt", "w" );
804  if ( !RipleysOutputPrb5 ) {
805  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
807  exit( 1 );
808  }
809  RipleysOutputPrb6 = fopen("RipleyOutput_Jun.txt", "w" );
810  if ( !RipleysOutputPrb6 ) {
811  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
813  exit( 1 );
814  }
815  RipleysOutputPrb7 = fopen("RipleyOutput_Jul.txt", "w" );
816  if ( !RipleysOutputPrb7 ) {
817  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
819  exit( 1 );
820  }
821  RipleysOutputPrb8 = fopen("RipleyOutput_Aug.txt", "w" );
822  if ( !RipleysOutputPrb8 ) {
823  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
825  exit( 1 );
826  }
827  RipleysOutputPrb9 = fopen("RipleyOutput_Sep.txt", "w" );
828  if ( !RipleysOutputPrb9 ) {
829  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
831  exit( 1 );
832  }
833  RipleysOutputPrb10 = fopen("RipleyOutput_Oct.txt", "w" );
834  if ( !RipleysOutputPrb10 ) {
835  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
837  exit( 1 );
838  }
839  RipleysOutputPrb11 = fopen("RipleyOutput_Nov.txt", "w" );
840  if ( !RipleysOutputPrb11 ) {
841  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
843  exit( 1 );
844  }
845  RipleysOutputPrb12 = fopen("RipleyOutput_Dec.txt", "w" );
846  if ( !RipleysOutputPrb12 ) {
847  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
849  exit( 1 );
850  }
851  return true;
852 }
static CfgStr cfg_RipleysOutput_filename("G_RIPLEYSOUTPUT_FILENAME", CFG_CUSTOM, "RipleysOutput.txt")
const char * value(void)
Definition: configurator.h:152
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
@ WARN_FILE
Definition: maperrormsg.h:37

References cfg_RipleysOutput_filename, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.

◆ OpenTheReallyBigProbe()

bool Population_Manager::OpenTheReallyBigProbe ( )

open the probe

859  {
861  if ( !ReallyBigOutputPrb ) {
862  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
864  exit( 1 );
865  }
866  return true;
867 }
static CfgStr cfg_ReallyBigOutput_filename("G_REALLYBIGOUTPUT_FILENAME", CFG_CUSTOM, "ReallyBigOutput.txt")

References cfg_ReallyBigOutput_filename, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.

Referenced by THare_Population_Manager::Init(), Bembidion_Population_Manager::Init(), Goose_Population_Manager::Init(), Partridge_Population_Manager::Init(), RoeDeer_Population_Manager::Init(), Skylark_Population_Manager::Init(), Vole_Population_Manager::Init(), and Newt_Population_Manager::Newt_Population_Manager().

◆ OpenTheRipleysOutputProbe()

bool Population_Manager::OpenTheRipleysOutputProbe ( string  a_NWordFilename)

◆ PartitionLiveDead()

unsigned Population_Manager::PartitionLiveDead ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute in reverse order

1015  {
1016  auto it = partition(TheArray[Type].begin(), TheArray[Type].begin() + m_LiveArraySize[Type], CompareStateAlive());
1017  // it now points at the first dead element
1018  // the number of live ones before it is it-TheArray[Type].begin(). This is the new vector size for live animals.
1019  return unsigned(it - TheArray[Type].begin());
1020 }
Function to compare to TAnimal's m_CurrentStateNo to anything but -1.
Definition: PopulationManager.cpp:205

◆ Probe()

float Population_Manager::Probe ( int  ListIndex,
probe_data p_TheProbe 
)
virtual

Default data probe. Rarely used in actuality but always available

Reimplemented in Bembidion_Population_Manager.

680  {
681  // Counts through the list and goes through each area to see if the animal
682  // is standing there and if the farm, veg or element conditions are met
683  AnimalPosition Sp;
684  float NumberSk = 0;
685  // Four possibilites
686  // either NoVegTypes or NoElementTypes or NoFarmTypes is >0 or all==0
687  if ( p_TheProbe->m_NoFarms != 0 ) {
688  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
689  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
690  unsigned Farm = TheArray[ ListIndex ] [ j ]->SupplyFarmOwnerRef();
691  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
692  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
693  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
694  for ( unsigned k = 0; k < p_TheProbe->m_NoFarms; k++ ) {
695  if ( p_TheProbe->m_RefFarms[ k ] == Farm )
696  NumberSk++; // it is in the square so increment number
697  }
698 
699  }
700  }
701  } else if ( p_TheProbe->m_NoEleTypes != 0 ) {
702  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
703  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
704  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
705  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
706  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
707  for ( unsigned k = 0; k < p_TheProbe->m_NoEleTypes; k++ ) {
708  if ( p_TheProbe->m_RefEle[ k ] == Sp.m_EleType )
709  NumberSk++; // it is in the square so increment number
710  }
711  }
712  }
713  } else {
714  if ( p_TheProbe->m_NoVegTypes != 0 ) {
715  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
716  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
717 
718  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
719  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
720  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) ) {
721  for ( unsigned k = 0; k < p_TheProbe->m_NoVegTypes; k++ ) {
722  if ( p_TheProbe->m_RefVeg[ k ] == Sp.m_VegType )
723  NumberSk++; // it is in the square so increment number
724  }
725  }
726  }
727  }
728  } else // both must be zero
729  {
730  unsigned sz = (unsigned)GetLiveArraySize( ListIndex );
731  // It is worth checking whether we have a total dump of all individuals
732  // if so don't bother with asking each where it is
733  if (p_TheProbe->m_NoAreas==1) {
734  if ((p_TheProbe->m_Rect[0].m_x1==0) && (p_TheProbe->m_Rect[0].m_y1==0) && (p_TheProbe->m_Rect[0].m_x2==(unsigned)SimW) &&
735  (p_TheProbe->m_Rect[0].m_y2==(unsigned)SimH)) {
736  return (float) sz;
737  }
738  }
739  // Asking for a subset - need to test them all
740  for ( unsigned j = 0; j < sz; j++ ) {
741  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
742  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
743  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
744  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
745  NumberSk++; // it is in the square so increment number
746  }
747  }
748  }
749  }
750  return NumberSk;
751 }
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175
The base class for all farm types.
Definition: farm.h:768
unsigned m_NoAreas
Definition: PopulationManager.h:292
TTypesOfVegetation m_RefVeg[25]
Definition: PopulationManager.h:297
rectangle m_Rect[10]
Definition: PopulationManager.h:293
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
unsigned m_NoFarms
Definition: PopulationManager.h:296
TTypesOfLandscapeElement m_RefEle[25]
Definition: PopulationManager.h:298
unsigned m_NoVegTypes
Definition: PopulationManager.h:295
unsigned m_NoEleTypes
Definition: PopulationManager.h:294
unsigned m_x1
Definition: PopulationManager.h:100
unsigned m_x2
Definition: PopulationManager.h:102
unsigned m_y2
Definition: PopulationManager.h:103
unsigned m_y1
Definition: PopulationManager.h:101

References AnimalPosition::m_EleType, probe_data::m_NoAreas, probe_data::m_NoEleTypes, probe_data::m_NoFarms, probe_data::m_NoVegTypes, probe_data::m_Rect, probe_data::m_RefEle, probe_data::m_RefFarms, probe_data::m_RefVeg, AnimalPosition::m_VegType, AnimalPosition::m_x, rectangle::m_x1, rectangle::m_x2, AnimalPosition::m_y, rectangle::m_y1, and rectangle::m_y2.

◆ ProbeFileInput()

int Population_Manager::ProbeFileInput ( char *  p_Filename,
int  p_ProbeNo 
)

Default probe file input

574  {
575  FILE * PFile;
576  int data = 0;
577  int data2 = 0;
578  char S[ 255 ];
579  PFile = fopen(p_Filename, "r" );
580  if ( !PFile ) {
581  m_TheLandscape->Warn( "Population Manager - cannot open Probe File ", p_Filename );
582  exit( 0 );
583  }
584  fgets( S, 255, PFile ); // dummy line
585  fgets( S, 255, PFile ); // dummy line
586  fscanf( PFile, "%d\n", & data ); // Reporting interval
587  TheProbe[ p_ProbeNo ]->m_ReportInterval = data;
588  fgets( S, 255, PFile ); // dummy line
589  fscanf( PFile, "%d\n", & data ); // Write to file
590  if ( data == 0 ) TheProbe[ p_ProbeNo ]->m_FileRecord = false; else
591  TheProbe[ p_ProbeNo ]->m_FileRecord = true;
592  fgets( S, 255, PFile ); // dummy line
593  for ( int i = 0; i < 10; i++ ) {
594  fscanf( PFile, "%d", & data );
595  if ( data > 0 ) TheProbe[ p_ProbeNo ]->m_TargetTypes[ i ] = true; else
596  TheProbe[ p_ProbeNo ]->m_TargetTypes[ i ] = false;
597  }
598 
599  fgets( S, 255, PFile ); // dummy line
600  fgets( S, 255, PFile ); // dummy line
601  fscanf( PFile, "%d", & data );
602  TheProbe[ p_ProbeNo ]->m_NoAreas = data;
603  fgets( S, 255, PFile ); // dummy line
604  fgets( S, 255, PFile ); // dummy line
605  fscanf( PFile, "%d", & data2 ); // No References areas
606  fgets( S, 255, PFile ); // dummy line
607  fgets( S, 255, PFile ); // dummy line
608  fscanf( PFile, "%d", & data ); // Type reference for probe
609  if ( data == 1 ) TheProbe[ p_ProbeNo ]->m_NoEleTypes = data2; else
610  TheProbe[ p_ProbeNo ]->m_NoEleTypes = 0;
611  if ( data == 2 ) TheProbe[ p_ProbeNo ]->m_NoVegTypes = data2; else
612  TheProbe[ p_ProbeNo ]->m_NoVegTypes = 0;
613  if ( data == 3 ) TheProbe[ p_ProbeNo ]->m_NoFarms = data2; else
614  TheProbe[ p_ProbeNo ]->m_NoFarms = 0;
615  fgets( S, 255, PFile ); // dummy line
616  fgets( S, 255, PFile ); // dummy line
617  // Now read in the areas data
618  for ( int i = 0; i < 10; i++ ) {
619  fscanf( PFile, "%d", & data );
620  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_x1 = data;
621  fscanf( PFile, "%d", & data );
622  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_y1 = data;
623  fscanf( PFile, "%d", & data );
624  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_x2 = data;
625  fscanf( PFile, "%d", & data );
626  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_y2 = data;
627  }
628  fgets( S, 255, PFile ); // dummy line
629  fgets( S, 255, PFile ); // dummy line
630  if ( TheProbe[ p_ProbeNo ]->m_NoVegTypes > 0 ) {
631  for ( int i = 0; i < 25; i++ ) {
632  fscanf( PFile, "%d", & data );
633  if ( data != 999 )
634  TheProbe[ p_ProbeNo ]->m_RefVeg[ i ] = m_TheLandscape->TranslateVegTypes( data );
635  }
636  } else if ( TheProbe[ p_ProbeNo ]->m_NoFarms > 0 ) {
637  for ( int i = 0; i < 25; i++ ) {
638  fscanf( PFile, "%d", & data );
639  if ( data != 999 )
640  TheProbe[ p_ProbeNo ]->m_RefFarms[ i ] = data;
641  }
642  } else {
643  for ( int i = 0; i < 25; i++ ) {
644  fscanf( PFile, "%d", & data );
645  if ( data != 999 ) TheProbe[ p_ProbeNo ]->m_RefEle[ i ] = m_TheLandscape->TranslateEleTypes( data );
646  }
647  }
648  fclose( PFile );
649  return data2; // number of data references
650 }
TTypesOfLandscapeElement TranslateEleTypes(int EleReference)
Definition: landscape.h:1648
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: landscape.h:1655
bool m_FileRecord
Definition: PopulationManager.h:290
bool m_TargetTypes[10]
Definition: PopulationManager.h:301
unsigned m_ReportInterval
Definition: PopulationManager.h:291

Referenced by GetProbeInput_ini().

◆ ProbeReport()

char * Population_Manager::ProbeReport ( int  a_time)
1273  {
1274 
1275  int No;
1276  char str[100]; // 100 out to be enough!!
1277  strcpy(g_str,"");
1278  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1279  No = 0;
1280  // See if we need to record/update this one
1281  // if time/months/years ==0 or every time
1282  if ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1283  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 2 ) && ( BeginningOfMonth() ) )
1284  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( Time % 365 == 0 ) ) ) {
1285  // Goes through each area and sends a value to OutputForm
1286  unsigned Index = SupplyListIndexSize();
1287  for ( unsigned listindex = 0; listindex < Index; listindex++ ) {
1288  if ( TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] )
1289  No += (int) Probe( listindex, TheProbe[ ProbeNo ] );
1290  }
1291  TheProbe[ ProbeNo ]->FileOutput( No, Time, ProbeNo );
1292  sprintf(str," %d ", No );
1293  strcat(g_str,str);
1294  }
1295  }
1296  return g_str;
1297 }
char g_str[255]
Definition: PopulationManager.cpp:129
unsigned SupplyListIndexSize()
Definition: PopulationManager.h:468
virtual float Probe(int ListIndex, probe_data *p_TheProbe)
Definition: PopulationManager.cpp:680
int m_NoProbes
Definition: PopulationManager.h:525
void FileOutput(int No, int time, int ProbeNo)
Definition: PopulationManager.cpp:1447

References BeginningOfMonth(), and g_str.

◆ ProbeReportTimed()

char * Population_Manager::ProbeReportTimed ( int  a_time)
1300  {
1301  int No;
1302  char str[100]; // 100 ought to be enough!!
1303  strcpy(g_str,"");
1304  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1305  No = 0;
1306  unsigned Index = SupplyListIndexSize();
1307  for ( unsigned listindex = 0; listindex < Index; listindex++ ) {
1308  if ( TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] ) No += (int) Probe( listindex, TheProbe[ ProbeNo ] );
1309  }
1310  TheProbe[ ProbeNo ]->FileOutput( No, Time, ProbeNo );
1311  sprintf(str," %d ", No );
1312  strcat(g_str,str);
1313  }
1314  return g_str;
1315 }

References g_str.

◆ Run()

void Population_Manager::Run ( int  NoTSteps)
virtual

This is the main scheduling method for the population manager.
Note the structure of Shuffle_or_Sort(), DoFirst(), BeginStep, DoBefore(), Step looping until all are finished, DoAfter(), DoAlmostLast(), EndStep, DoLast().

Can do multiple time-steps here inside one landscape time-step (a day). This is used in the roe deer model to provide 10 minute behavioural time-steps.

It is necessary to remove any dead animals before the timestep starts. It is possible that animals are killed after their population manager Run method has been executed. This is the case with geese and hunters. Checking death first prevents this becomming a problem.

Reimplemented in TPredator_Population_Manager.

337  {
341  for ( int TSteps = 0; TSteps < NoTSteps; TSteps++ )
342  {
343  unsigned size2;
344  unsigned size1 = (unsigned) TheArray.size();
349  for ( unsigned listindex = 0; listindex < size1; listindex++ )
350  {
351  // Must check each object in the list for m_CurrentStateNo==-1
352  m_LiveArraySize[listindex] = PartitionLiveDead(listindex);
353  }
354 #ifdef __ALMASS_VISUAL
355  if (m_MainForm!=NULL)
356  {
357  int n = 0;
358  for ( unsigned listindex = 0; listindex < size1; listindex++ ) n += (int) m_LiveArraySize[ listindex ];
360  //if (n>0) DisplayLocations();
361  }
362 #endif
363  // begin step actions ...
364  // set all stepdone to false.... is this really necessary??
365  for ( unsigned listindex = 0; listindex < size1; listindex++ )
366  {
367  size2 = (unsigned) GetLiveArraySize(listindex);
368  for ( unsigned j = 0; j < size2; j++ )
369  {
370  TheArray[ listindex ] [ j ]->SetStepDone( false );
371  }
372  }
373 
374  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
375  // Call the Shuffle/Sort procedures
376  Shuffle_or_Sort( listindex );
377  }
378  // Need to check if Ripleys Statistic needs to be saved
380  int Year = m_TheLandscape->SupplyYearNumber();
381  if (Year >= cfg_RipleysOutputFirstYear.value()) {
382  if (Year % cfg_RipleysOutput_interval.value() == 0) {
383  int day = m_TheLandscape->SupplyDayInYear();
384  if (cfg_RipleysOutput_day.value() == day) {
385  // Do the Ripley Probe
387  }
388  }
389  }
390  }
391  // Need to check if AOR output needs to be saved
392  if (cfg_AOROutput_used.value()) {
393  int Year = m_TheLandscape->SupplyYearNumber();
394  if (Year >= cfg_AOROutputFirstYear.value()) {
395  if (Year % cfg_AOROutput_interval.value() == 0) {
396  int day = m_TheLandscape->SupplyDayInYear();
397  if (cfg_AOROutput_day.value() == day) {
398  // Do the AOR Probe
400  }
401  }
402  }
403  }
404  // Need to check if Monthly Ripleys Statistic needs to be saved
406  if (m_TheLandscape->SupplyDayInMonth()==1) {
407  int Year = m_TheLandscape->SupplyYearNumber();
408  if (Year>=cfg_RipleysOutputFirstYear.value()) {
409  if ( Year % cfg_RipleysOutput_interval.value() == 0 ) {
410  int month = m_TheLandscape->SupplyMonth();
411  // Do the Ripley Probe
412  switch (month) {
414  break;
416  break;
418  break;
420  break;
422  break;
424  break;
426  break;
428  break;
430  break;
432  break;
434  break;
436  break;
437  }
438  }
439  }
440  }
441  }
442  // Need to check if Really Big Probe needs to be saved
444  int Year = m_TheLandscape->SupplyYearNumber();
445  if (Year>=cfg_ReallyBigOutputFirstYear.value()) {
446  if ( Year % cfg_ReallyBigOutput_interval.value() == 0 ) {
447  int day = m_TheLandscape->SupplyDayInYear();
449  {
450  // Do the Ripley Probe
452  }
453  }
454  }
455  }
457  if ( yr > cfg_CatastropheEventStartYear.value() ) {
459  Catastrophe(); // This method must be overidden in descendent classes
460  }
461  DoFirst();
462  // call the begin-step-method of all objects
463  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
464  size2 = (unsigned)GetLiveArraySize( listindex );
465  for (unsigned j = 0; j < size2; j++)
466  TheArray[ listindex ] [ j ]->BeginStep();
467  }
468  DoBefore();
469  // call the step-method of all objects
470  do {
471  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
472  size2 = (unsigned)GetLiveArraySize( listindex );
473  for (unsigned j = 0; j < size2; j++) {
474  TheArray[ listindex ] [ j ]->Step();
475  }
476  } // for listindex
477  } while ( !StepFinished() );
478  DoAfter();
479  // call the end-step-method of all objects
480  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
481  size2 = (unsigned)GetLiveArraySize( listindex );
482  for (unsigned j = 0; j < size2; j++) {
483  TheArray[ listindex ] [ j ]->EndStep();
484  }
485  }
486  // ----------------
487  // end of this step actions
488  // For each animal list
489  DoAlmostLast();
490 
491 DoLast();
492  } // End of time step loop
493 }
static CfgInt cfg_RipleysOutput_interval("G_RIPLEYSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
CfgInt cfg_CatastropheEventStartYear("PM_CATASTROPHEEVENTSTARTYEAR", CFG_CUSTOM, 99999)
static CfgInt cfg_AOROutput_interval("G_AORSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
static CfgInt cfg_AOROutputFirstYear("G_AOROUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
static CfgInt cfg_AOROutput_day("G_AOROUTPUT_DAY", CFG_CUSTOM, 60)
static CfgInt cfg_ReallyBigOutput_day4("G_REALLYBIGOUTPUT_DAY_FOUR", CFG_CUSTOM, 274)
static CfgInt cfg_ReallyBigOutput_day1("G_REALLYBIGOUTPUT_DAY_ONE", CFG_CUSTOM, 1)
static CfgInt cfg_ReallyBigOutput_day2("G_REALLYBIGOUTPUT_DAY_TWO", CFG_CUSTOM, 91)
static CfgInt cfg_RipleysOutputFirstYear("G_RIPLEYSOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
static CfgInt cfg_ReallyBigOutput_interval("G_REALLYBIGOUTPUT_INTERVAL", CFG_CUSTOM, 1)
static CfgInt cfg_ReallyBigOutputFirstYear("G_REALLYBIGOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
static CfgInt cfg_RipleysOutput_day("G_RIPLEYSOUTPUT_DAY", CFG_CUSTOM, 60)
static CfgInt cfg_ReallyBigOutput_day3("G_REALLYBIGOUTPUT_DAY_THREE", CFG_CUSTOM, 182)
int SupplyYearNumber(void)
Definition: landscape.h:1616
int SupplyDayInYear(void)
Definition: landscape.h:1596
int SupplyMonth(void)
Definition: landscape.h:1601
virtual void DoLast()
Definition: PopulationManager.cpp:530
virtual void TheAOROutputProbe()
Definition: PopulationManager.cpp:924
virtual void TheReallyBigOutputProbe()
Definition: PopulationManager.cpp:913
virtual void DoFirst()
Definition: PopulationManager.cpp:320
virtual void Catastrophe()
Definition: PopulationManager.cpp:1109
virtual bool StepFinished()
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step ...
Definition: PopulationManager.cpp:498
virtual void TheRipleysOutputProbe(FILE *a_prb)
Definition: PopulationManager.cpp:918
unsigned PartitionLiveDead(unsigned Type)
Definition: PopulationManager.cpp:1015
virtual void DoBefore()
Definition: PopulationManager.cpp:328
void Shuffle_or_Sort(unsigned Type)
Definition: PopulationManager.cpp:1073
virtual void DoAfter()
Definition: PopulationManager.cpp:513
virtual void DoAlmostLast()
Definition: PopulationManager.cpp:522

References cfg_AOROutput_day, cfg_AOROutput_interval, cfg_AOROutput_used, cfg_AOROutputFirstYear, cfg_CatastropheEventStartYear, cfg_ReallyBigOutput_day1, cfg_ReallyBigOutput_day2, cfg_ReallyBigOutput_day3, cfg_ReallyBigOutput_day4, cfg_ReallyBigOutput_interval, cfg_ReallyBigOutput_used, cfg_ReallyBigOutputFirstYear, cfg_RipleysOutput_day, cfg_RipleysOutput_interval, cfg_RipleysOutput_used, cfg_RipleysOutputFirstYear, cfg_RipleysOutputMonthly_used, CfgInt::value(), and CfgBool::value().

Referenced by RunTheSim().

◆ SetNoProbes()

void Population_Manager::SetNoProbes ( int  a_pn)
inline
431 { m_NoProbes = a_pn; }

References m_NoProbes.

Referenced by CreatePopulationManager().

◆ Shuffle()

void Population_Manager::Shuffle ( unsigned  Type)
protected

Run once through the list swapping randomly chosen elements

1055  {
1056  unsigned s = (unsigned)GetLiveArraySize( Type );
1057  for ( unsigned i = 0; i < s; i++ ) {
1058  TAnimal * temp;
1059  unsigned a = random( s );
1060  unsigned b = random( s );
1061  temp = TheArray[ Type ] [ a ];
1062  TheArray[ Type ] [ a ] = TheArray[ Type ] [ b ];
1063  TheArray[ Type ] [ b ] = temp;
1064  }
1065 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142

References random().

Referenced by Vole_Population_Manager::DoFirst().

◆ Shuffle_or_Sort()

void Population_Manager::Shuffle_or_Sort ( unsigned  Type)
protected

This method is used to determine whether the array of animals should be shuffled or sorted.
To do nothing ensure that the BeforeStepActions[] is set appropriately // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = sortXIndex, 4 = do nothing

1073  {
1074  switch ( BeforeStepActions[ Type ] ) {
1075  case 0:
1076  Shuffle( Type );
1077  break;
1078  case 1:
1079  SortX( Type );
1080  break;
1081  case 2:
1082  SortY( Type );
1083  break;
1084  case 3:
1085  SortXIndex( Type );
1086  break;
1087  case 4: // Do nothing
1088  break;
1089  case 5:
1090  if (g_rand_uni() < double (1/500)) Shuffle( Type );
1091  break;
1092  default:
1093  m_TheLandscape->Warn( "Population_Manager::Shuffle_or_Sort- BeforeStepAction Unknown", NULL );
1094  exit( 1 );
1095  }
1096 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
void SortX(unsigned Type)
Definition: PopulationManager.cpp:979
void SortXIndex(unsigned Type)
Definition: PopulationManager.cpp:1027
void SortY(unsigned Type)
Definition: PopulationManager.cpp:989
void Shuffle(unsigned Type)
Definition: PopulationManager.cpp:1055

References g_rand_uni.

◆ SortState()

void Population_Manager::SortState ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute

999  {
1000  sort( TheArray[ Type ].begin(), TheArray[ Type ].end(), CompareState() );
1001 }
Function to compare to TAnimal's Current behavioural state.
Definition: PopulationManager.cpp:171

◆ SortStateR()

void Population_Manager::SortStateR ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute in reverse order

1008  {
1009  sort(TheArray[Type].begin(), TheArray[Type].begin()+m_LiveArraySize[Type], CompareStateR());
1010 }
Function to compare to TAnimal's m_CurrentStateNo.
Definition: PopulationManager.cpp:183

◆ SortX()

void Population_Manager::SortX ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_x attribute

979  {
980  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
981  sort( TheArray[ Type ].begin(), nth, CompareX() );
982 }
Function to compare to TAnimal's m_Location_x.
Definition: PopulationManager.cpp:146

◆ SortXIndex()

void Population_Manager::SortXIndex ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_x attribute, and make an indexing array

1027  {
1028  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
1029  sort(TheArray[Type].begin(), nth, CompareX());
1030  unsigned s = (unsigned)GetLiveArraySize( Type );
1031  // Now make the index array to X;
1032  int counter = 0;
1033  int x;
1034  // for each individual
1035  for ( unsigned i = 0; i < s; i++ ) {
1036  // Get Next co-ordiated
1037  x = TheArray[ Type ] [ i ]->Supply_m_Location_x();
1038  // fill gaps up to x
1039  while ( counter < x ) IndexArrayX[ Type ] [ counter++ ] = -1;
1040  if ( x == counter ) {
1041  IndexArrayX[ Type ] [ counter++ ] = i;
1042  }
1043  }
1044  // Fill up the rest of the array with -1;
1045  for ( int c = counter; c < 10000; c++ ) {
1046  IndexArrayX[ Type ] [ c ] = -1;
1047  }
1048 }
int IndexArrayX[5][10000]
Definition: PopulationManager.h:509

◆ SortY()

void Population_Manager::SortY ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_y attribute

989  {
990  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
991  sort(TheArray[Type].begin(), nth, CompareY());
992 }
Function to compare to TAnimal's m_Location_y.
Definition: PopulationManager.cpp:157

◆ SpeciesSpecificReporting()

char * Population_Manager::SpeciesSpecificReporting ( int  a_species,
int  a_time 
)

This method handles species specific outputs. This is one place to do it. More commonly this is done in descendent classes

1121  {
1122  strcpy(g_str,"");
1123 // Vole Model
1124  if ( a_species == 1 ) {
1125 /*
1126 // The next lines are obselete code from genetic simulations
1127 float MeanNoAlleles;
1128  float MeanHO;
1129  float MeanHE;
1130  unsigned size;
1131 
1132  if ( m_time % ( 365 * 24 * 60 ) == 0 ) // End of year
1133  {
1134 
1135  // empty the GenStruc data
1136  for ( int ProbeNo = 0; ProbeNo < ( int )m_NoProbes; ProbeNo++ ) {
1137  fprintf( m_GeneticsFile, "%d ", m_time );
1138  int TotalSize = 0;
1139  m_AManager->AlFreq->Flush();
1140  for ( unsigned listindex = 0; listindex <= 1; listindex++ ) {
1141  size = 0;
1142  m_AManager->TheGeneticProbe( listindex, ProbeNo, size );
1143  TotalSize += size;
1144  }
1145  if ( TotalSize > 0 ) {
1146  m_AManager->AlFreq->CalcAF();
1147  m_AManager->AlFreq->CalcNoAlleles();
1148  m_AManager->AlFreq->CalcHE();
1149  m_AManager->AlFreq->CalcHO( TotalSize );
1150  }
1151  // Get the means
1152  // For N alleles
1153  int NA = 0;
1154  float NHO = 0;
1155  float NHE = 0;
1156  for ( int l = 0; l < 16; l++ ) {
1157  NA += m_AManager->AlFreq->SupplyNoAlleles( l );
1158  }
1159  MeanNoAlleles = ( float )NA / 16.0;
1160  for ( int l = 0; l < 16; l++ ) {
1161  NHO += m_AManager->AlFreq->SupplyHO( l );
1162  }
1163  MeanHO = NHO / 16.0;
1164  for ( int l = 0; l < 16; l++ ) {
1165  NHE += m_AManager->AlFreq->SupplyHE( l );
1166  }
1167  MeanHE = NHE / 16.0;
1168 
1169  // Do some output
1170  // Output is to two files, the genetics file and the AllelerequencyFile
1171  fprintf( m_GeneticsFile, "%2.2f ", MeanNoAlleles );
1172  fprintf( m_GeneticsFile, "%1.3f ", MeanHO );
1173  fprintf( m_GeneticsFile, "%1.3f ", MeanHE );
1174  for ( int l = 0; l < 16; l++ ) {
1175  fprintf( m_GeneticsFile, "%04i ", m_AManager->AlFreq->SupplyNoAlleles( l ) );
1176  }
1177  for ( int l = 0; l < 16; l++ ) {
1178  fprintf( m_GeneticsFile, "%1.3f ", m_AManager->AlFreq->SupplyHO( l ) );
1179  }
1180  for ( int l = 0; l < 16; l++ ) {
1181  fprintf( m_GeneticsFile, "%1.3f ", m_AManager->AlFreq->SupplyHE( l ) );
1182  }
1183  fprintf( m_GeneticsFile, "\n" );
1184  fprintf( m_AlleleFreqsFile, "%d ", m_time );
1185  for ( int l = 0; l < 16; l++ ) {
1186  for ( int al = 0; al < 4; al++ ) {
1187  fprintf( m_AlleleFreqsFile, "%1.3f ", m_AManager->AlFreq->SupplyAF( l, al ) );
1188  }
1189  }
1190  fprintf( m_AlleleFreqsFile, "\n" );
1191  }
1192  // make sure progress reaches the disk
1193  fflush( m_GeneticsFile );
1194  fflush( m_AlleleFreqsFile );
1195  }
1196 
1197  if ( cfg_UseEasyPop.value()) {
1198  int targettime=a_time % ( 365 * 100 );
1199  if ( ( targettime == 59 ) ||(targettime == 181)||(targettime ==304)||(targettime ==59+365)||(targettime ==181+365)||(targettime ==304+365)) {
1200  for ( unsigned listindex = 0; listindex <= 1; listindex++ ) {
1201  GeneticsResultsOutput( m_EasyPopRes, listindex);
1202  }
1203  fflush( m_EasyPopRes );
1204  }
1205  }
1206 */
1207  /* Three times a year reporting
1208  if ( m_time % 365 == 60 ) ProbeReportNow( m_time );
1209  if ( m_time % 365 == 152 ) ProbeReportNow( m_time );
1210  if ( m_time % 365 == 273 ) ProbeReportNow( m_time ); */
1211  ProbeReport( a_time );
1212 #ifdef __SpecificPesticideEffectsVinclozolinLike__
1213  ImpactProbeReport( a_time );
1214 #endif
1215 #ifdef __WithinOrchardPesticideSim__
1216  ImpactProbeReport( a_time );
1217 #endif
1218 
1219  }
1220  // Skylark Model
1221  else if ( a_species == 0 ) {
1222  int No;
1223  int a_day = a_time % 365;
1224  if ( a_time % 365 == 364 )
1225  {
1226  //Write the Breeding Attempts Probe
1227  int BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts;
1228  No = TheBreedingSuccessProbe( BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts );
1229  float bs = 0;
1230  if ( BreedingFemales > 0 ) {
1231  bs = No / ( float )BreedingFemales; //bs = successful breeding attempt per attempting to breed female
1232  }
1233  BreedingSuccessProbeOutput( bs, BreedingFemales, YoungOfTheYear, TotalPop,
1234  TotalFemales, TotalMales, a_time, BreedingAttempts );
1235  }
1236  if ( a_day == 152 ) {
1237  // Need to fill in the landscape from 1st June, it will change before
1238  // the count of fledgelings is needed
1240  }
1241  if ( a_day == 197 ) {
1242  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1243  No = TheFledgelingProbe();
1244  // Do some output
1245  FledgelingProbeOutput( No, a_time );
1246  }
1247  }
1248 #ifdef __SKPOM
1249  // This is clunky but for purposes of validation we want probes throughout the year
1250  // First get the breeding pairs data.
1251  BreedingPairsOutput(a_day);
1252 #else
1253  ProbeReport( a_time );
1254 #endif
1255  }
1256  else return ProbeReport( a_time );
1257  return g_str;
1258 }
void FillVegAreaData()
Definition: Landscape.cpp:3641
virtual void BreedingPairsOutput(int)
Definition: PopulationManager.h:641
virtual int TheBreedingSuccessProbe(int &, int &, int &, int &, int &, int &)
Definition: PopulationManager.h:651
char * ProbeReport(int a_time)
Definition: PopulationManager.cpp:1273
void ImpactProbeReport(int a_Time)
Definition: PopulationManager.cpp:1321
virtual void FledgelingProbeOutput(int, int)
Definition: PopulationManager.h:654
virtual void BreedingSuccessProbeOutput(double, int, int, int, int, int, int, int)
Definition: PopulationManager.h:649
virtual int TheFledgelingProbe()
Definition: PopulationManager.h:646

References g_str, ImpactProbeReport(), and ProbeReport().

Referenced by RunTheSim().

◆ StepFinished()

bool Population_Manager::StepFinished ( void  )
protectedvirtual

Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour.

Returns true if and only if all objects have finished the current step

Reimplemented in TPredator_Population_Manager, and Hunter_Population_Manager.

498  {
499  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
500  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( listindex ); j++) {
501  if ( TheArray[ listindex ] [ j ]->GetStepDone() == false ) {
502  return false;
503  }
504  }
505  }
506  return true;
507 }

◆ SupplyAnimalPtr()

TAnimal* Population_Manager::SupplyAnimalPtr ( int  a_index,
int  a_animal 
)
inline

Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK.

465  {
466  return TheArray[a_index][a_animal];
467  }

References TheArray.

Referenced by AOR_Probe_Goose::DoProbe().

◆ SupplyCovPosx()

virtual int Population_Manager::SupplyCovPosx ( int  )
inlinevirtual

Reimplemented in Partridge_Population_Manager.

626  {
627  return 0;
628  }

◆ SupplyCovPosy()

virtual int Population_Manager::SupplyCovPosy ( int  )
inlinevirtual

Reimplemented in Partridge_Population_Manager.

629  {
630  return 0;
631  }

◆ SupplyListIndexSize()

unsigned Population_Manager::SupplyListIndexSize ( )
inline
468  {
469  return (unsigned)TheArray.size();
470  }

References TheArray.

Referenced by Skylark_Population_Manager::ProbeReportPOM().

◆ SupplyListName()

const char* Population_Manager::SupplyListName ( int  i)
inline
478  {
479  return m_ListNames[i];
480  }

References m_ListNames.

◆ SupplyListNameLength()

int Population_Manager::SupplyListNameLength ( )
inline
461  {
462  return m_ListNameLength;
463  }
unsigned m_ListNameLength
Definition: PopulationManager.h:538

References m_ListNameLength.

◆ SupplyListSize()

unsigned Population_Manager::SupplyListSize ( unsigned  listindex)
inline
471  {
472  return (unsigned)TheArray[listindex].size();
473  }

References TheArray.

◆ SupplyLocXY()

virtual void Population_Manager::SupplyLocXY ( unsigned  listindex,
unsigned  j,
int &  x,
int &  y 
)
inlinevirtual
493  {
494  x = TheArray[listindex][j]->Supply_m_Location_x();
495  y = TheArray[listindex][j]->Supply_m_Location_y();
496  }

References TheArray.

◆ SupplyPegPosx()

virtual int Population_Manager::SupplyPegPosx ( int  )
inlinevirtual

Reimplemented in Partridge_Population_Manager.

620  {
621  return 0;
622  }

◆ SupplyPegPosy()

virtual int Population_Manager::SupplyPegPosy ( int  )
inlinevirtual

Reimplemented in Partridge_Population_Manager.

623  {
624  return 0;
625  }

◆ SupplySimH()

int Population_Manager::SupplySimH ( )
inline
455  {
456  return SimH;
457  }

References SimH.

Referenced by Skylark_Female::st_Floating(), Skylark_Male::st_Floating(), and Skylark_Female::st_Laying().

◆ SupplySimW()

int Population_Manager::SupplySimW ( )
inline
452  {
453  return SimW;
454  }

References SimW.

Referenced by Skylark_Female::st_Floating(), Skylark_Male::st_Floating(), and Skylark_Female::st_Laying().

◆ SupplyState()

int Population_Manager::SupplyState ( unsigned  listindex,
unsigned  j 
)
inline

IntArray100 * SupplyStateList() { return & StateList; }

490  {
491  return TheArray[listindex][j]->WhatState();
492  }

References TheArray.

◆ SupplyStateNames()

const char* Population_Manager::SupplyStateNames ( int  i)
inline
497  {
498  return StateNames[i];
499  }
const char * StateNames[100]
Definition: PopulationManager.h:531

References StateNames.

Referenced by Skylark_Female::Step(), and Skylark_Male::Step().

◆ SupplyStateNamesLength()

unsigned Population_Manager::SupplyStateNamesLength ( )
inline
500  {
501  return StateNamesLength;
502  }

References StateNamesLength.

◆ SupplyStepSize()

int Population_Manager::SupplyStepSize ( )
inline
449  {
450  return m_StepSize;
451  }
int m_StepSize
Definition: PopulationManager.h:533

References m_StepSize.

◆ TheAOROutputProbe()

void Population_Manager::TheAOROutputProbe ( )
virtual

◆ TheBreedingFemalesProbe()

virtual int Population_Manager::TheBreedingFemalesProbe ( int  )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

643  {
644  return 0;
645  }

◆ TheBreedingSuccessProbe()

virtual int Population_Manager::TheBreedingSuccessProbe ( int &  ,
int &  ,
int &  ,
int &  ,
int &  ,
int &   
)
inlinevirtual

Reimplemented in Skylark_Population_Manager.

651  {
652  return 0;
653  }

◆ TheFledgelingProbe()

virtual int Population_Manager::TheFledgelingProbe ( )
inlinevirtual

Reimplemented in Skylark_Population_Manager.

646  {
647  return 0;
648  }

◆ TheGeneticProbe()

virtual void Population_Manager::TheGeneticProbe ( unsigned  ,
int  ,
unsigned &   
)
inlinevirtual
656  {
657  }

◆ TheReallyBigOutputProbe()

void Population_Manager::TheReallyBigOutputProbe ( )
virtual

This method must be overridden in descendent classes

Reimplemented in Vole_Population_Manager, and Bembidion_Population_Manager.

913  {
914 }

◆ TheRipleysOutputProbe()

void Population_Manager::TheRipleysOutputProbe ( FILE *  a_prb)
virtual

Member Data Documentation

◆ AOROutputPrb

ofstream* Population_Manager::AOROutputPrb
protected

◆ BeforeStepActions

◆ IndexArrayX

int Population_Manager::IndexArrayX[5][10000]

◆ lamdagrid

long int Population_Manager::lamdagrid[2][257][257]
protected

Referenced by LamdaBirth(), LamdaClear(), and LamdaDeath().

◆ m_AlleleFreqsFile

FILE* Population_Manager::m_AlleleFreqsFile
protected

◆ m_AOR_Probe

◆ m_catastrophestartyear

◆ m_EasyPopRes

FILE* Population_Manager::m_EasyPopRes
protected

◆ m_GeneticsFile

FILE* Population_Manager::m_GeneticsFile
protected

◆ m_ListNameLength

◆ m_ListNames

◆ m_LiveArraySize

vector<unsigned> Population_Manager::m_LiveArraySize
protected

◆ m_NoProbes

int Population_Manager::m_NoProbes
protected

◆ m_population_type

◆ m_SeasonNumber

◆ m_SimulationName

◆ m_StepSize

int Population_Manager::m_StepSize
protected

◆ m_TheLandscape

Landscape* Population_Manager::m_TheLandscape

Referenced by RoeDeer_Population_Manager::AddToFightlist(), RoeDeer_Population_Manager::AddToGroup(), Vole_Population_Manager::AssessHabitat(), Rabbit_Population_Manager::AssessPctForage(), Rabbit_Population_Manager::AssignStaticVariables(), Goose_Population_Manager::BangAtPoly(), Vole_Population_Manager::BarrierSearch(), Bembidion_Population_Manager::Catastrophe(), THare_Population_Manager::Catastrophe(), Partridge_Population_Manager::Catastrophe(), Skylark_Population_Manager::Catastrophe(), Vole_Population_Manager::Catastrophe(), Hunter_Population_Manager::CheckDensity(), Rabbit_Population_Manager::CheckForRabbitBreedingConditions(), Rabbit_Population_Manager::ClassifyHabitat(), Partridge_Population_Manager::CreateCloneObjects(), Partridge_Population_Manager::CreateInitialObjects(), Partridge_Population_Manager::CreateNestingCoverDensityMap(), RoeDeer_Population_Manager::CreateNewGroup(), Partridge_Population_Manager::CreateObjects(), Hunter_Population_Manager::CreateObjects(), Goose_Population_Manager::CreateObjects(), Vole_Population_Manager::CreateObjects_Init(), RodenticidePredators_Population_Manager::CreatHabitatQualGrid(), Partridge_Population_Manager::DissolveCovey(), Hunter_Population_Manager::DistributeHunters(), Hunter_Population_Manager::DistributeHuntersByRules(), Partridge_Population_Manager::DoAfter(), THare_Population_Manager::DoAlmostLast(), Partridge_Population_Manager::DoAlmostLast(), Goose_Population_Manager::DoEmigration(), THare_Population_Manager::DoFirst(), Hunter_Population_Manager::DoFirst(), Newt_Population_Manager::DoFirst(), Partridge_Population_Manager::DoFirst(), Rabbit_Population_Manager::DoFirst(), RoeDeer_Population_Manager::DoFirst(), Skylark_Population_Manager::DoFirst(), Vole_Population_Manager::DoFirst(), Bembidion_Population_Manager::DoFirst(), Goose_Population_Manager::DoFirst(), Goose_Population_Manager::DoImmigration(), Goose_Population_Manager::DoLast(), Rabbit_Population_Manager::DoLast(), Bembidion_Population_Manager::DoLast(), Partridge_Population_Manager::DoMaleSanityCheck(), Partridge_Population_Manager::DoSanityCheck(), Partridge_Population_Manager::EvalHabitatQual(), RodenticidePredators_Population_Manager::EvaluatePoly(), THare_Population_Manager::ExtraPopMort(), Skylark_Population_Manager::FledgelingProbeOutput(), Vole_Population_Manager::GeneticsOutputFile(), Vole_Population_Manager::GeneticsResultsOutput(), RoeDeer_Population_Manager::GetFixList(), Goose_Population_Manager::GetForageLocIndex(), THare_Population_Manager::GetGrowthEfficiency(), THare_Population_Manager::GetGrowthEfficiencyF(), THare_Population_Manager::GetGrowthEfficiencyP(), THare_Population_Manager::GetInterference(), THare_Population_Manager::GetKJperM(), THare_Population_Manager::GetLitterSize(), THare_Population_Manager::GetMaxDailyGrowthEnergy(), THare_Population_Manager::GetMaxDailyGrowthEnergyF(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare_Population_Manager::GetRMR(), Goose_Population_Manager::Goose_Population_Manager(), Goose_Population_Manager::GooseEnergyRecordOutput(), Goose_Population_Manager::GooseFieldForageInfoOutput(), Goose_Population_Manager::GooseHabitatUseFieldObsOutput(), Goose_Population_Manager::GooseHabitatUseOutput(), Goose_Population_Manager::GooseIndLocCountOutput(), Goose_Population_Manager::GooseLeaveReasonStatOutput(), Goose_Population_Manager::GoosePopulationDescriptionOutput(), Goose_Population_Manager::GooseWeightStatOutput(), Partridge_Population_Manager::HabitatEvalPolyField(), Vole_Population_Manager::ImpactedProbe(), THare_Population_Manager::Init(), Bembidion_Population_Manager::Init(), Goose_Population_Manager::Init(), Hunter_Population_Manager::Init(), Partridge_Population_Manager::Init(), RoeDeer_Population_Manager::Init(), Skylark_Population_Manager::Init(), Vole_Population_Manager::Init(), Bembidion_Population_Manager::IsStartHabitat(), Vole_Population_Manager::IsTrap(), Vole_Population_Manager::LandscapeQuadrantOutputProbe(), Rabbit_Population_Manager::LoadWarrenLocations(), Partridge_Population_Manager::MaleImmigration(), THare_Population_Manager::MRROutputs(), Rabbit_Population_Manager::NatalDispersalRecordOutput(), Goose_Population_Manager::NewForageLocation(), Newt_Population_Manager::Newt_Population_Manager(), Goose_Population_Manager::ObservedOpennessQuery(), Vole_Population_Manager::OpenResistanceOutput(), Skylark_Population_Manager::OpenTheFledgelingProbe(), Newt_Population_Manager::OutputMetamorphosisStats(), Rabbit_Population_Manager::PesticideDeathRecordOutput(), THare_Population_Manager::POMOutputs(), TPredator_Population_Manager::PredAutumnSample(), TPredator_Population_Manager::PredSampleFile(), TPredator_Population_Manager::PredSpringAutumnSample(), TPredator_Population_Manager::PredSpringSample(), Rabbit_Population_Manager::PreProcessWarrenLocations(), Bembidion_Population_Manager::Probe(), Rabbit_Population_Manager::Rabbit_Population_Manager(), RodenticidePredators_Population_Manager::ReadHabitatValues(), Hunter_Population_Manager::RecordHuntingSuccess(), RoeDeer_Population_Manager::RemoveFixList(), RoeDeer_Population_Manager::RemoveFromFightlist(), RoeDeer_Population_Manager::RemoveFromGroup(), Goose_Population_Manager::RemoveMaxForageKj(), Rabbit_Population_Manager::ReproOutputRecordOutput(), Vole_Population_Manager::ResistanceOutput(), Hunter_Population_Manager::RuleSet10Based(), TPredator_Population_Manager::Run(), Hunter_Population_Manager::SaveFarmHunters(), Vole_Population_Manager::SendMessage(), Newt_Population_Manager::SetFreeLivingMortChance(), Goose_Population_Manager::StateStatOutput(), Vole_Population_Manager::SuitableStartingLocation(), Partridge_Population_Manager::TestShouldFlock(), Vole_Population_Manager::TheAgeSexLocationProbe(), Bembidion_Population_Manager::TheReallyBigOutputProbe(), Vole_Population_Manager::TheReallyBigOutputProbe(), Bembidion_Population_Manager::TheRipleysOutputProbe(), THare_Population_Manager::TheRipleysOutputProbe(), Partridge_Population_Manager::TheRipleysOutputProbe(), RoeDeer_Population_Manager::TheRipleysOutputProbe(), Skylark_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheSexRatiosProbe(), RodenticidePredators_Population_Manager::Tick(), TPredator_Population_Manager::TPredator_Population_Manager(), Partridge_Population_Manager::UpdateNestingCoverMap(), Rabbit_Population_Manager::WarrenLegalPos(), Rabbit_Population_Manager::WarrenOccupancyRecordOutput(), and Goose_Population_Manager::XYDump().

◆ ProbesSet

bool Population_Manager::ProbesSet

◆ ReallyBigOutputPrb

◆ RipleysOutputPrb

FILE* Population_Manager::RipleysOutputPrb
protected

◆ RipleysOutputPrb1

FILE* Population_Manager::RipleysOutputPrb1
protected

◆ RipleysOutputPrb10

FILE* Population_Manager::RipleysOutputPrb10
protected

◆ RipleysOutputPrb11

FILE* Population_Manager::RipleysOutputPrb11
protected

◆ RipleysOutputPrb12

FILE* Population_Manager::RipleysOutputPrb12
protected

◆ RipleysOutputPrb2

FILE* Population_Manager::RipleysOutputPrb2
protected

◆ RipleysOutputPrb3

FILE* Population_Manager::RipleysOutputPrb3
protected

◆ RipleysOutputPrb4

FILE* Population_Manager::RipleysOutputPrb4
protected

◆ RipleysOutputPrb5

FILE* Population_Manager::RipleysOutputPrb5
protected

◆ RipleysOutputPrb6

FILE* Population_Manager::RipleysOutputPrb6
protected

◆ RipleysOutputPrb7

FILE* Population_Manager::RipleysOutputPrb7
protected

◆ RipleysOutputPrb8

FILE* Population_Manager::RipleysOutputPrb8
protected

◆ RipleysOutputPrb9

FILE* Population_Manager::RipleysOutputPrb9
protected

◆ SimH

◆ SimHH

◆ SimW

◆ SimWH

◆ StateNames

◆ StateNamesLength

unsigned Population_Manager::StateNamesLength
protected

◆ TestFile

FILE* Population_Manager::TestFile
protected

◆ TestFile2

FILE* Population_Manager::TestFile2
protected

◆ TheArray

vector< TListOfAnimals > Population_Manager::TheArray
protected

Referenced by Partridge_Population_Manager::AddObject(), Goose_Population_Manager::BangAtPoly(), Bembidion_Population_Manager::Bembidion_Population_Manager(), Goose_Population_Manager::BirdsShot(), Skylark_Population_Manager::BreedingPairsOutput(), Bembidion_Population_Manager::Catastrophe(), THare_Population_Manager::Catastrophe(), Partridge_Population_Manager::Catastrophe(), Skylark_Population_Manager::Catastrophe(), Vole_Population_Manager::Catastrophe(), Partridge_Population_Manager::ClutchDensity(), Partridge_Population_Manager::CreateCloneObjects(), Partridge_Population_Manager::CreateInitialObjects(), Rabbit_Population_Manager::CreateLocalWarrenNetworkLists(), Partridge_Population_Manager::CreateObjects(), Hunter_Population_Manager::CreateObjects(), Skylark_Population_Manager::CreateObjects(), Goose_Population_Manager::CreateObjects(), Newt_Population_Manager::CreateObjects(), TPredator_Population_Manager::CreateObjects(), Bembidion_Population_Manager::CreateObjects(), THare_Population_Manager::CreateObjects(), RoeDeer_Population_Manager::CreateObjects(), Rabbit_Population_Manager::CreateObjects(), Vole_Population_Manager::CreateObjects(), Vole_Population_Manager::CreateObjects_Init(), Partridge_Population_Manager::DoAlmostLast(), Goose_Population_Manager::DoEmigration(), THare_Population_Manager::DoFirst(), Hunter_Population_Manager::DoFirst(), Newt_Population_Manager::DoFirst(), Partridge_Population_Manager::DoFirst(), Rabbit_Population_Manager::DoFirst(), RoeDeer_Population_Manager::DoFirst(), Vole_Population_Manager::DoFirst(), Bembidion_Population_Manager::DoFirst(), Goose_Population_Manager::DoLast(), Partridge_Population_Manager::DoMaleSanityCheck(), Partridge_Population_Manager::DoSanityCheck(), THare_Population_Manager::ExtraPopMort(), Partridge_Population_Manager::FillCoveyNeigbourList(), Rabbit_Population_Manager::FindClosestWarren(), Vole_Population_Manager::FindOutsideRadiusMale(), Vole_Population_Manager::FindRandomMale(), Vole_Population_Manager::GeneticsOutputFile(), Vole_Population_Manager::GeneticsResultsOutput(), Hunter_Population_Manager::GetHunterHome(), Hunter_Population_Manager::GetHunterHuntLoc(), Goose_Population_Manager::GetLeader(), Vole_Population_Manager::GetVoleAllele(), Goose_Population_Manager::Goose_Population_Manager(), Goose_Population_Manager::GoosePopulationDescriptionOutput(), Hunter_Population_Manager::Hunter_Population_Manager(), Partridge_Population_Manager::Hunting(), THare_Population_Manager::Hunting(), Partridge_Population_Manager::HuntingDifferentiatedBeetleBankArea(), THare_Population_Manager::HuntingDifferentiatedBeetleBankArea(), Partridge_Population_Manager::HuntingGrid(), THare_Population_Manager::HuntingGrid(), Vole_Population_Manager::ImpactedProbe(), TPredator_Population_Manager::InOtherTerritory(), IsLast(), Vole_Population_Manager::LandscapeQuadrantOutputProbe(), Partridge_Population_Manager::MaleImmigration(), THare_Population_Manager::MRROutputs(), Newt_Population_Manager::Newt_Population_Manager(), Partridge_Population_Manager::ObjectLoopFetch(), Partridge_Population_Manager::ObjectLoopInit(), Partridge_Population_Manager::Partridge_Population_Manager(), THare_Population_Manager::POMOutputs(), TPredator_Population_Manager::PredAutumnSample(), TPredator_Population_Manager::PredSampleFile(), TPredator_Population_Manager::PredSpringAutumnSample(), TPredator_Population_Manager::PredSpringSample(), Rabbit_Population_Manager::PreProcessWarrenLocations(), Bembidion_Population_Manager::Probe(), Skylark_Population_Manager::ProbePOM(), Skylark_Population_Manager::ReHouse(), Vole_Population_Manager::ResistanceOutput(), RoeDeer_Population_Manager::RoeDeer_Population_Manager(), TPredator_Population_Manager::Run(), Rabbit_Population_Manager::SaveWarrenLocations(), Vole_Population_Manager::SendMessage(), Skylark_Population_Manager::Skylark_Population_Manager(), TPredator_Population_Manager::StepFinished(), Rabbit_Population_Manager::SupplyAllBigRabbits(), SupplyAnimalPtr(), Partridge_Population_Manager::SupplyCovPosx(), Partridge_Population_Manager::SupplyCovPosy(), RoeDeer_Population_Manager::SupplyFemaleRC(), RoeDeer_Population_Manager::SupplyFemales(), SupplyListIndexSize(), SupplyListSize(), SupplyLocXY(), RoeDeer_Population_Manager::SupplyMaleRC(), RoeDeer_Population_Manager::SupplyMales(), Partridge_Population_Manager::SupplyPegPosx(), Partridge_Population_Manager::SupplyPegPosy(), SupplyState(), RoeDeer_Population_Manager::SupplyTMales(), Partridge_Population_Manager::TestShouldFlock(), THare_Population_Manager::THare_Population_Manager(), Vole_Population_Manager::TheAgeSexLocationProbe(), Skylark_Population_Manager::TheBreedingFemalesProbe(), Skylark_Population_Manager::TheBreedingSuccessProbe(), Skylark_Population_Manager::TheFledgelingProbe(), Bembidion_Population_Manager::TheReallyBigOutputProbe(), Vole_Population_Manager::TheReallyBigOutputProbe(), Bembidion_Population_Manager::TheRipleysOutputProbe(), THare_Population_Manager::TheRipleysOutputProbe(), Partridge_Population_Manager::TheRipleysOutputProbe(), RoeDeer_Population_Manager::TheRipleysOutputProbe(), Skylark_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheRipleysOutputProbe(), Vole_Population_Manager::TheSexRatiosProbe(), TPredator_Population_Manager::TPredator_Population_Manager(), RoeDeer_Population_Manager::UpdateRanges(), Vole_Population_Manager::Vole_Population_Manager(), Rabbit_Population_Manager::WarrenLegalPos(), Rabbit_Population_Manager::WarrenOccupancyRecordOutput(), Goose_Population_Manager::XYDump(), and Rabbit_Population_Manager::~Rabbit_Population_Manager().

◆ TheProbe

probe_data* Population_Manager::TheProbe[100]

The documentation for this class was generated from the following files: